package com.why.websocketmqttstudy.why.mqtt.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import java.util.*;

/**
 * MQTT配置项
 * 
 * @author why
 *
 */
@Configuration
@RefreshScope
@ConfigurationProperties(prefix = "mqtt.config")
public class MqttConfig {

	private String userName = "emqx";

	private String password = "public";

	private String hostUrl = "tcp://broker-cn.emqx.io:1883";

	private String clientId = "publish_clien";

	private int timeOut = 20;
	
	private int keepAlive = 20;

	private List<String> topicList = new ArrayList<>();
	
	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getHostUrl() {
		return hostUrl;
	}

	public void setHostUrl(String hostUrl) {
		this.hostUrl = hostUrl;
	}

	public String getClientId() {
		return clientId;
	}

	public void setClientId(String clientId) {
		this.clientId = clientId;
	}

	public int getTimeOut() {
		return timeOut;
	}

	public void setTimeOut(int timeOut) {
		this.timeOut = timeOut;
	}

	public List<String> getTopicList() {
		topicList.add("mqtt/hello");
		return topicList;
	}

	public void setTopicList(List<String> topicList) {
		this.topicList = topicList;
	}

	public int getKeepAlive() {
		return keepAlive;
	}

	public void setKeepAlive(int keepAlive) {
		this.keepAlive = keepAlive;
	}
}
